package com.panopset.db;

import java.io.StringWriter;

class FieldIdKey extends DataField {
    static final String INT_NOT_NULL = " bigint not null";
    private static final String AUTO_INDEX = INT_NOT_NULL + " auto_increment";

    public FieldIdKey(final String name) {
        super(name);
        setIndexed(true);
    }

    protected boolean isPrimaryKey() {
        return true;
    }

    @Override
    public String getAttributes() {
        if (attrs == null) {
            StringWriter sw = new StringWriter();
            sw.append(AUTO_INDEX);
            attrs = sw.toString();
        }
        return attrs;
    }

    private String attrs;
}
